import 'package:chatbot/yanses.dart';
import 'package:chatbot/fwtk.dart';
import 'package:chatbot/yinsi_yemian.dart';
import 'package:chatbot/utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:share_plus/share_plus.dart';

class WodeYemian extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return MineState();
  }
}

class MineState extends State<WodeYemian> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Yanse.qianse,
      appBar: AppBar(
          elevation: 0,
          leading: IconButton(
              onPressed: () {
                Navigator.pop(context);
              },
              icon: const Icon(
                Icons.arrow_back_ios,
                color: Colors.black,
                size: 20,
              )),
          backgroundColor: Yanse.qianse,
          title: const Text(
            "我的",
            style: TextStyle(
                color: Colors.black, fontSize: 16, fontWeight: FontWeight.w600),
          )),
      body: SingleChildScrollView(
        child: Column(
          children: [
            xuanxiang(Icons.share, "分享好友", () {
              Share.share('https://apps.apple.com/cn/app/id6451178132');
            }),
            xuanxiang(Icons.security, "隐私条款", () {
              Navigator.push(context,
                  CupertinoPageRoute(builder: (BuildContext context) {
                return YinsiYemian();
              }));
            }),
            xuanxiang(Icons.verified, "用户协议", () {
              Navigator.push(context,
                  CupertinoPageRoute(builder: (BuildContext context) {
                return FWYemian();
              }));
            }),
            xuanxiang(Icons.help, "关于", () {
              Utils.xianshiTishi("Version 1.0");
            }),
          ],
        ),
      ),
    );
  }

  xuanxiang(IconData tubiao, String biaoti, VoidCallback voidCallback) {
    return InkWell(
      onTap: () {
        voidCallback();
      },
      child: Container(
        margin: const EdgeInsets.fromLTRB(16, 8, 16, 8),
        width: MediaQuery.of(context).size.width - 32,
        height: 42,
        child: Row(
          children: [
            Icon(
              tubiao,
              size: 24,
              color: Colors.black,
            ),
            Container(
              width: 12,
            ),
            Text(
              biaoti,
              style: const TextStyle(
                  color: Colors.black,
                  fontSize: 15,
                  fontWeight: FontWeight.w600),
            ),
            Expanded(child: Container()),
            const Icon(
              Icons.arrow_forward_ios,
              size: 16,
              color: Colors.black,
            )
          ],
        ),
      ),
    );
  }
}
